package cloud.keveri.example.response4j.interfaces;

import cloud.keveri.response4j.SkipWrap;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 作者：沈自在
 **/
@Controller
@RequestMapping("/response4j/test")
public class TestController {

    /**
     *
     */
    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class User {
        String name = "沈自在";
        Integer age = 18;
    }

    /**
     *
     */
    @GetMapping
    public String hello() {
        return "你好";
    }

    /**
     *
     */
    @GetMapping("/user01")
    @ResponseBody
    public User user01() {
        return new User();
    }

    @GetMapping("/user02")
    @ResponseBody
    @SkipWrap
    public User user02() {
        return new User("田浩然", 23);
    }
}
